package com.tang.objectOriented.senior.codeblock_;

public class CodeBlockDetail03 {
    //编写一个main方法
    public static void main(String[] args) {
        new BBB();
        //1.AAA的静态代码块...
        //2.BBB的静态代码块...
        //3.AAA的普通代码块
        //4.AAA() 构造器被调用
        //5.BBB的普通代码块
        //6.getN1的普通属性被调用...
        //7.BBB() 构造器被调用
    }
}

class AAA { //父类Object
    static {
        System.out.println("AAA的静态代码块...");
    }
    {
        System.out.println("AAA的普通代码块");
    }
    public AAA() {
        //(1)super()
        //(2)调用本类的普通代码块
        System.out.println("AAA() 构造器被调用....");
    }
}

class BBB extends AAA  {
    static {
        System.out.println("BBB的静态代码块...");
    }

    {
        System.out.println("BBB的普通代码块...");
    }
    public BBB() {
        //(1)super()
        //(2)调用本类的普通代码块
        System.out.println("BBB() 构造器被调用....");
    }

    private int getN1(){
        System.out.println("getN1的普通属性被调用...");
        return 100;
    }
    private int n1=getN1();
}

